feat(fspy-ipc-str): convert IpcStr and platform C strings directly - #669
Merged
Conversation
fspy benchmarklinuxmacoswindows |
VirtualAlloc at a system-chosen address and the matching MEM_RELEASE VirtualFree, both kernel calls that never touch the CRT heap lock, so they are usable under the loader lock. This is the bottom layer for a cross-platform fspy_nostd_alloc page allocator. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
VirtualAllocator is the Windows twin of MmapAllocator: stateless, one fresh committed region per allocation, released as a whole — kernel calls only, so it works under the loader lock. The chunk pool and arena build on a platform-selected PageAllocator and now compile everywhere. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
wan9chi
force-pushed
the
agent/fspy-ipc-str-oscstr
branch
from
August 14, 2026 01:56
5f21a43 to
b929875
Compare
from_os_c_str borrows the units of an OsCStr zero-copy, and to_os_c_string_in decodes into an OsCString in a caller-chosen allocator, reading Windows code units bytewise so the unaligned IpcStr representation never matters. Neither direction touches OsStr, so both work without std. to_boxed rounds out ownership for callers that store the result. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
channel() serializes the shm id straight from the keeper's C string via IpcStr::from_os_c_str, and sender() decodes it with to_os_c_string_in backed by the fspy_nostd_alloc arena — removing the UTF-16 to WTF-8 to UTF-16 round trip and the global-allocator use on the preload attach path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
wan9chi
force-pushed
the
agent/fspy-ipc-str-oscstr
branch
from
August 14, 2026 02:29
b929875 to
2648b62
Compare
wan9chi
marked this pull request as ready for review
August 14, 2026 03:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The shm id still crossed the process boundary through
OsStr: on Windows,IpcStr's UTF-16 bytes were decoded to WTF-8 (OsString) and re-encoded back to UTF-16 — two global-allocator allocations while the preload attaches under the loader lock. The preload is going std-free bottom-to-top, and the allocator is the bottom, so this lands the cross-platform arena together with its first consumer.Built in commit order:
VirtualAlloc/VirtualFreewrappers — kernel calls that never touch the CRT heap lock, usable under the loader lock.VirtualAllocator, the stateless Windows twin ofMmapAllocator; the chunk pool andarena()now compile on every platform over a platform-selected page allocator.from_os_c_strborrows anOsCStr's units zero-copy, andto_os_c_string_indecodes into a caller-chosen allocator, reading Windows code units bytewise soIpcStr's unaligned representation never matters. Neither direction touchesOsStr.channel()serializes the id straight from the keeper's C string, andsender()decodes it with the arena — noOsStrround trip and no global-allocator use on the attach path.Stack created with GitHub Stacks CLI • Give Feedback 💬